package com.my.study.designPatterns.proxyPattern.dynamicProxy;

import java.lang.reflect.Proxy;

public class UserServiceDriver {

    public static void main(String[] args) {


        UserService userService = new UserServiceImp();

        //Proxy.newProxyInstance 动态加载
        UserService userService1 = (UserService) Proxy.newProxyInstance(userService.getClass().getClassLoader(),
                userService.getClass().getInterfaces(), new UserServiceDynamicProxy(userService));

        System.out.println(userService1.getUserById(1));
    }
}
